using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace ScavengerHunt
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class VoidBunny : Microsoft.Xna.Framework.DrawableGameComponent
    {
        Model model;
        Vector3 position;
        Camera cam;

        public VoidBunny(Game game, Camera camera)
            : base(game)
        {
            // TODO: Construct any child components here
            cam = camera;
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            position = new Vector3(0.0f, 0.0f, 0.0f);
            base.Initialize();
        }

        protected override void LoadContent()
        {
            model = Game.Content.Load<Model>("Maya\\VoidBunny");
            foreach (ModelMesh mm in model.Meshes)
            {
                foreach (Effect e in mm.Effects)
                {
                    IEffectLights iel = e as IEffectLights;
                    if (iel != null)
                    {
                        iel.EnableDefaultLighting();
                    }
                }
            }
            base.LoadContent();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            model.Draw(Matrix.CreateTranslation(position), cam.View, cam.Projection);
            base.Draw(gameTime);
        }
    }
}
